﻿@inherits AdminCompontentBase
@page "/team/index"
@page "/team"

<PageTitle>@T("Team")</PageTitle>

<MRow>
    <MCol Md="12" Class="d-flex justify-space-between  align-center">
        <div class="h6 regular-secondary--text">@T("Team")</div>
        <div Class="d-flex justify-end">
            <SSearch @bind-Value="_search" BackgroundColor="#fff" Class="mr-6" OnEnter="SearchKeyDown" />
            <PermissionView Code="@ElementPermissionCodes.TeamAdd">
                <SButton Small Class="rounded-lg" OnClick="_addSheet.Show" BorderRadiusClass="rounded-lg">
                    <SIcon Size=18 IsDefaultToolTip="false">@IconConstants.Add</SIcon>
                    <span class="ml-2 btn">@T("Add")</span>
                </SButton>
            </PermissionView>
        </div>
    </MCol>
</MRow>
<MRow Style="overflow:auto;max-height: calc(100vh - 170px);">
    @if (!_showEmptyPlaceholder)
    { 
        foreach (var team in _teams)
        {
            <MCol Md="4" Xl="3" Class="pa-2">
                <TeamCard Team=team OnEditClick="()=>EditTeamHandler(team.Id)" />
            </MCol>
        }
    }
    else
    {
        <SEmptyPlaceholder Class="mx-2" Height="calc(100vh - 170px);" />
    }
</MRow>

<AddSheet OnSubmit="OnCreate" @ref="_addSheet" />
<UpdateSheet @ref="_updateSheet" OnUpdate="OnUpdate" OnDelete="OnDelete" />